<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Home extends MY_Controller {
	function __construct(){
		parent::__construct();
	}

	function index(){
		$this->_assign("isIndex", TRUE);
		$this->load->model('restaurant_model','restaurantModel');
        $this->load->model('travel_model','travelModel');
	    $where["order"] = "pos_cr_date desc";
	    $where["limit"] = "3";
	    $where["where"]["status"] = "1";
	    $where["where"]["parent_id"] = "0";
	    $where["where"]["type"] = "restaurant";
	    $where["where"]["img_firstimage"] = "1";
	    $whereTravel["order"] = "pos_cr_date desc";
	    $whereTravel["limit"] = "4";
	    $whereTravel["where"]["status"] = "1";
	    $whereTravel["where"]["type"] = "travel";
	    $whereTravel["where"]["img_firstimage"] = "1";
	    $restaurantResult = $this->restaurantModel->getin($where);
	    $travelResult = $this->travelModel->getImage($whereTravel);
	    $this->_assign("resList",$restaurantResult);
	    $this->_assign("traList",$travelResult);
	    //var_dump($restaurantResult);exit();
		$this->_fetch("index");
	}

	function admin_index(){
		
		if(!$this->ion_auth->in_group("admin")){
			show_404();
		}

		$this->_fetch("admin_index");
	}

	function search(){
    $post = $this->input->post();
    PageUtil::addVar("title",$this->lang->line("rest_admin_title"));
    $this->load->model('post_model','typeModel');
    //$where["order"] = "pos_cr_date desc";
    $where["like"]["title"] = $post['title'];
    $where["where"]["status"] ="1";
    $typeResult = $this->typeModel->get($where);
    $this->_assign("searchList",$typeResult);
    //var_dump($typeResult);exit();
    $this->_fetch("search_index");
    }
    
}